refs: allow overwrite of empty folders
authorYu Qi Zhang <jzehrarnyg@gmail.com>
Mon, 20 Jun 2016 20:20:58 +0000 (20:20 +0000)
committerAtomic Bot <atomic-devel@projectatomic.io>
Tue, 21 Jun 2016 20:20:15 +0000 (20:20 +0000)
commit744543110e3d12464a752d59956dc24a0f99b1d2
tree13b39a275a2130dad7ae4f5654e66ca2c0a9eeaa
parentf6ce04e4807c2934a5aba5522201998c815c7233
refs: allow overwrite of empty folders

We noticed that once a ref folder is created, there is no existing
command that can remove it. For example, once "foo/bar" is created,
even if the user deletes foo or all the refs under foo, the folder
will persist.

Now when the user attempts to create a ref "foo" either through commit
or refs --create, if a folder "foo" exists but is empty of refs, the
folder is removed and the new ref "foo" is created.

New unit tests in tests-ref.sh verify this functionality.

Closes: #354
Approved by: cgwalters
src/libostree/ostree-repo-refs.c
src/ostree/ot-builtin-commit.c
src/ostree/ot-builtin-refs.c
tests/test-refs.sh